<div id="posts" class="backend-item users">
	<br>
	<h2 class="backend-h2">
		<span class="img"></span>
		<span> Danh sách tài khoản</span>
        <a href="<?php echo $this->baseUrl('/admin/user/add/');?>">Thêm user</a>
    </h2>
    <p class="saporator"><br /></p>
    
    <div id="tabs">
		<ul>
			<li><a href="#tabs-1">Danh sách sinh viên</a></li>
			<li class="tabs-2"><a href="#tabs-2">Danh sách giáo viên</a></li>
			
		</ul>
		
		<div id="tabs-1">
			<form action="" method="get">
				<input type="hidden" name="student" value="">
				
		        <p class="search_box">
		            <input class="sbt hover focus" type="text" name="search_box_text" title="Nhập vào tên cần tìm"/>
		            <input class="sbc input-hover" type="submit" name="search_box_sumit"  value="Tìm"/>
		        </p><!-- End .search_box-->
		         <p class="saporator sf"><br /></p>
		         
		        <div class="table_nav">
		                <div class="table_nav_left">
		                    <select id="tbn_cat" name="tbn_cate">
		                        <option value="0" selected="selected">Hiển thị tất cả</option>
		                    <?php 
		                    	foreach ($this->tenLop as $lop) {
		                    		echo '<option value ="'.$lop['tenLop'].'">Lớp '.$lop['tenLop'].'</option>';
		                    	}
		                    ?>                 
		                    </select>
		                    
		                    <input type="submit" value="Lọc" name="tbn_filter" class="tbn_button input-hover"/> <!-- tbn: là viết tắt của từ table_nav trong div class="table_nav" -->
		                    <input type="submit" value="Xóa" name="del" class="tbn_button input-hover"/>
		                </div><!-- end .table_nav_left -->
		                <div class="table_nav_pages">  
		                <?php 
		                	//phan trang
							echo $this->paginationControl($this->paginator,'sliding','paginator.phtml');
						?>                           
		                </div>
		            </div><!-- End .table_nav-->
		        <table id="p_post">
		            <thead>
		                <tr>
		                    <th class="col-1-user"><input class="check-all" type="checkbox" /></th>
		                    <th class="col-2-user">Username</th>
		                    <th class="col-3-user">Họ và tên</th>
		                    <th class="col-4-user">Email</th>
		                    <th class="col-5-user">Ngày sinh</th>
		                    <th class="col-6-user">Quyền</th>
		                    <th class="col-7-user">Lớp</th>                    
		                </tr>
		            </thead>
		            <tbody>
		            <?php echo "<pre>";
		             
		            	foreach ($this->paginator as $user){
		            		
		            ?>    
		                <tr>
		                    <th class="col-1-user">
		                        <input class="sub-check" name="lop-check[]" type="checkbox" value="<?php echo $user['username'];?>"/>
		                    </th>
		                    <th class="col-2-user"><?php echo $user['username'];?></th>
		                    <th class="col-3-user post_title">
		                        <strong><a href="" class="title_ct"><?php echo $user['hoDem']." ".$user['ten'];?></a></strong> 
		                    <div class="row_action">
		                        <span class="row_edit">
		                        	<a href="<?php echo $this->baseUrl('/admin/user/add/?edit&user='.$user['username']);?>">Sửa</a>|
		                        </span>
		                        <span class="row_del">
		                        	<a href="<?php echo $this->baseUrl('/admin/user/delete/?delete&user='.$user['username']);?>">Xóa</a>
		                        </span>                        
		                    </div>
		                    </th>
		                    
		                    <th class="col-4-user"><?php echo $user['email']; ?></th>
		                    <th class="col-5-user"><?php echo $user['ngaySinh']; ?></th>
		                    <th class="col-6-user"><?php echo $user['quyen']; ?></th>
		                    <th class="col-7-user"><?php echo $user['tenLop']; ?></th>
		                </tr>                                          
		            <?php 
		            	}
		            ?>             
		            </tbody>
		            <tfoot>
		                <tr>
		                    <th class="col-1-user"><input class="check-all" type="checkbox" /></th>
		                    <th class="col-2-user">Username</th>
		                    <th class="col-3-user">Họ và tên</th>
		                    <th class="col-4-user">Email</th>
		                    <th class="col-5-user">Ngày sinh</th>
		                    <th class="col-6-user">Quyền</th>
		                    <th class="col-7-user">Lớp</th>                
		                </tr>
		            </tfoot>
		        </table>
		                
		    </form>
		</div> <!-- End #tab1 -->
		
		<div id="tabs-2">
			<?php echo $this->action('teacher', 'user','admin',array());?>
		</div><!-- End #tab1 -->
		
	</div> <!--  End #tabs -->
</div><!-- end #posts -->

<script type="text/javascript">
    $(document).ready(function(){
        $.extend({
            getUrlVars: function(){
                var vars = [], hash;
                var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
                for(var i = 0; i < hashes.length; i++){
                    hash = hashes[i].split('=');
                    vars.push(hash[0]);
                    vars[hash[0]] = hash[1];
                }
                return vars;
            },
            getUrlVar: function(name){
                return $.getUrlVars()[name];
            }
        });
        
        paramSelect = $.getUrlVar('teach');
        //alert(paramSelect);
        if(paramSelect !=null){
            $('#tabs-1').addClass('ui-tabs-hide');
            $('.ui-state-active').removeClass('ui-tabs-selected ui-state-active');
            
            $('.tabs-2').addClass('ui-tabs-selected ui-state-active');            
            $('#tabs-2').removeClass('ui-tabs-hide');
            
        }
       
    });
</script>
